home *** CD-ROM | disk | FTP | other *** search
/ BBS in a Box 3 / BBS in a box - Trilogy III.iso / Files / Prog / B-C / Color Window Demo / activate.c < prev    next >
Encoding:
C/C++ Source or Header  |  1990-01-31  |  1.3 KB  |  48 lines  |  [TEXT/KAHL]

  1. #include "my color.h"
  2.  
  3. do_activate(an_event)
  4. EventRecord    *an_event;
  5. {
  6. CWindowPeek        peek;
  7. ControlHandle    control;
  8.  
  9.     peek = (CWindowPeek)an_event->message;
  10.     if (an_event->modifiers & 01) 
  11.     {            /*application window is becoming active*/
  12.         SetPort((GrafPtr)an_event->message);
  13.         SelectWindow((CWindowPtr)an_event->message);
  14.         textH = (TEHandle)((CWindowPeek)an_event->message)->refCon;
  15.         TEActivate(textH);    /* NEEDED TO CAUSE Text CURSOR BLINKING */
  16.         EnableItem (myMenus[fileM],closeItem);
  17.         DisableItem(myMenus[editM],undoItem);
  18.         control = peek->controlList;
  19.         while(control)
  20.         {
  21.             ShowControl(control);
  22.             control = (*control)->nextControl;
  23.         }                                    
  24.         DrawGrowIcon((CWindowPtr)an_event->message);
  25.         if (((CWindowPeek)FrontWindow())->nextWindow->windowKind < 0)
  26.             scrCopyErr = TEFromScrap();
  27.     }    /*if an_event->modifiers*/
  28.     else    /*application window is becoming inactive*/
  29.     {
  30.         TEDeactivate(((CWindowPeek)an_event->message)->refCon);
  31.         if (((CWindowPeek)FrontWindow())->windowKind > 0)
  32.         {
  33.             control = peek->controlList;
  34.             while(control)
  35.             {
  36.                 HideControl(control);
  37.                 control = (*control)->nextControl;
  38.             }                                    
  39.             DrawGrowIcon((CWindowPtr)an_event->message);
  40.             EnableItem (myMenus[editM], undoItem);
  41.             scrapErr = ZeroScrap(); 
  42.             scrCopyErr = TEToScrap();
  43.         }/*if WindowPeek*/
  44.         else 
  45.             DisableItem (myMenus[editM], undoItem);
  46.     } /*else*/
  47. }
  48.